<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
Notation
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot140.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot139.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot142.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc304">A.2</A>&nbsp;&nbsp;Notation</H2><UL>
<LI><A HREF="umsroot141.html#toc165">Character Classes</A>
<LI><A HREF="umsroot141.html#toc166">Groups of characters</A>
<LI><A HREF="umsroot141.html#toc167">Valid Tokens</A>
<LI><A HREF="umsroot141.html#toc168">Escape Sequences within Strings and Atoms</A>
</UL>

The following notation is used in the syntax specification in this chapter:
<UL CLASS="itemize"><LI CLASS="li-itemize">
a term_h is a term which is the head of the clause.
<LI CLASS="li-itemize">a term_h(N) is a term_h of maximum precedence N.
<LI CLASS="li-itemize">a term_g is a term which is a goal (body) of the clause.
<LI CLASS="li-itemize">a term_g(N) is a term_g of maximum precedence N.
<LI CLASS="li-itemize">a term_a is a term which is an argument of a compound term or a list.
<LI CLASS="li-itemize">a term(N) can be any term (term_h, term_a or term_h) 
of maximum precedence N.
<LI CLASS="li-itemize">fx(N) is a prefix operator of precedence N which is not right associative.
<LI CLASS="li-itemize">fy(N) is a prefix operator of precedence N which is right associative.
<LI CLASS="li-itemize">similar definitions apply for infix (xfx, xfy, yfx) and postfix 
(xf, yf) operators.
</UL>
<A NAME="toc165"></A>
<H3 CLASS="subsection"><A NAME="htoc305">A.2.1</A>&nbsp;&nbsp;Character Classes</H3>
<A NAME="charclass"></A>
<A NAME="@default1186"></A>
The following character classes exist:
<BR>
<BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=left NOWRAP><B>Character Class</B></TD>
<TD ALIGN=left NOWRAP><B>Notation Used </B></TD>
<TD ALIGN=left NOWRAP><B>Default Members</B></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>&nbsp;</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>upper_case</TD>
<TD ALIGN=left NOWRAP>UC</TD>
<TD ALIGN=left NOWRAP>all upper case letters</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>underline</TD>
<TD ALIGN=left NOWRAP>UL</TD>
<TD ALIGN=left NOWRAP><CODE>_</CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>lower_case</TD>
<TD ALIGN=left NOWRAP>LC</TD>
<TD ALIGN=left NOWRAP>all lower case letters</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>digit</TD>
<TD ALIGN=left NOWRAP>N</TD>
<TD ALIGN=left NOWRAP>digits</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>blank_space</TD>
<TD ALIGN=left NOWRAP>BS</TD>
<TD ALIGN=left NOWRAP>space, tab and nonprintable ASCII characters</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>end_of_line</TD>
<TD ALIGN=left NOWRAP>NL</TD>
<TD ALIGN=left NOWRAP>line feed</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>atom_quote</TD>
<TD ALIGN=left NOWRAP>AQ</TD>
<TD ALIGN=left NOWRAP><CODE>'</CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>string_quote</TD>
<TD ALIGN=left NOWRAP>SQ</TD>
<TD ALIGN=left NOWRAP><CODE>"</CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>list_quote</TD>
<TD ALIGN=left NOWRAP>LQ</TD>
<TD ALIGN=left NOWRAP>&nbsp;</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>radix</TD>
<TD ALIGN=left NOWRAP>RA</TD>
<TD ALIGN=left NOWRAP>&nbsp;</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ascii</TD>
<TD ALIGN=left NOWRAP>AS</TD>
<TD ALIGN=left NOWRAP>&nbsp;</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>solo</TD>
<TD ALIGN=left NOWRAP>SL</TD>
<TD ALIGN=left NOWRAP><CODE>! ; </CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>special</TD>
<TD ALIGN=left NOWRAP>DS</TD>
<TD ALIGN=left NOWRAP><CODE>( [ { ) ] } , | </CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>line_comment</TD>
<TD ALIGN=left NOWRAP>CM</TD>
<TD ALIGN=left NOWRAP><CODE>%</CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>escape</TD>
<TD ALIGN=left NOWRAP>ES</TD>
<TD ALIGN=left NOWRAP><CODE>\</CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>first_comment</TD>
<TD ALIGN=left NOWRAP>CM1</TD>
<TD ALIGN=left NOWRAP><CODE>/</CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>second_comment</TD>
<TD ALIGN=left NOWRAP>CM2</TD>
<TD ALIGN=left NOWRAP><CODE>*</CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>symbol</TD>
<TD ALIGN=left NOWRAP>SY</TD>
<TD ALIGN=left NOWRAP><CODE># + - . : &lt; = &gt; ? @ ^ ` ~ $ &amp; </CODE></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>terminator</TD>
<TD ALIGN=left NOWRAP>TS</TD>
<TD ALIGN=left NOWRAP>&nbsp;</TD>
</TR></TABLE><BR>
The character class of any character can be modified by a
<A HREF="../bips/kernel/syntax/set_chtab-2.html"><B>chtab-declaration</B></A><A NAME="@default1187"></A>.<BR>
<BR>
<A NAME="toc166"></A>
<H3 CLASS="subsection"><A NAME="htoc306">A.2.2</A>&nbsp;&nbsp;Groups of characters</H3><BR>
<BR>
<DIV CLASS="flushleft">
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=left NOWRAP>&nbsp;</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><B>Group Type</B></TD>
<TD ALIGN=left NOWRAP><B>Notation</B></TD>
<TD ALIGN=left NOWRAP><B>Valid Characters</B></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>&nbsp;</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>alphanumerical</TD>
<TD ALIGN=left NOWRAP>ALP</TD>
<TD ALIGN=left NOWRAP>UC UL LC N</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>any character</TD>
<TD ALIGN=left NOWRAP>ANY</TD>
<TD ALIGN=left NOWRAP>&nbsp;</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>non escape</TD>
<TD ALIGN=left NOWRAP>NES</TD>
<TD ALIGN=left NOWRAP>any character except escape</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>sign</TD>
<TD ALIGN=left NOWRAP>SGN</TD>
<TD ALIGN=left NOWRAP><CODE>+ -</CODE></TD>
</TR></TABLE>
</DIV><BR>
<BR>
<A NAME="toc167"></A>
<H3 CLASS="subsection"><A NAME="htoc307">A.2.3</A>&nbsp;&nbsp;Valid Tokens</H3>
<A NAME="tokendef"></A>
Terms are defined in terms of tokens, and tokens are defined in terms of
characters and character classes.
Individual tokens can be read with the predicates
<A HREF="../bips/kernel/iochar/read_token-2.html"><B>read_token/2</B></A><A NAME="@default1188"></A> and
<A HREF="../bips/kernel/iochar/read_token-3.html"><B>read_token/3</B></A><A NAME="@default1189"></A>.
The description of the valid tokens follows.<BR>
<BR>

<H4 CLASS="subsubsection">Constants</H4>
<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
<B>atoms</B>
<PRE CLASS="verbatim">
ATOM    = (LC ALP*)
        | (SY | CM1 | CM2 | ES)+
        | (AQ (NES | ES ANY+)* AQ)
        | SL
        | []
        | {}
        | |
</PRE><BR>
<BR>
<LI CLASS="li-enumerate"><B>numbers</B>
<OL CLASS="enumerate" type=a><LI CLASS="li-enumerate"><B>integers</B><BR>
<PRE CLASS="verbatim">
INT = [SGN] N+
</PRE><BR>
<BR>
<LI CLASS="li-enumerate"><B>based integers</B><BR>
<PRE CLASS="verbatim">
INTBAS = [SGN] N+ (AQ | RA) (N | LC | UC)+
</PRE>The base must be an integer between 1 and 36 included, the value 
being valid for this base.<BR>
<BR>
If the syntax option <B>iso_base_prefix</B> is active, the syntax for based
integers is instead
<PRE CLASS="verbatim">
INTBAS = [SGN] 0 (b | o | x) (N | LC | UC)+
</PRE>which allows binary, octal and hexadecimal numbers respectively.<BR>
<BR>
<LI CLASS="li-enumerate"><B>character codes</B><BR>
<PRE CLASS="verbatim">
INTCHAR = [SGN] 0 (AQ | RA) ANY | AS ANY
</PRE>The value of the integer is the character code of the last character.<BR>
<BR>
<LI CLASS="li-enumerate"><B>rationals</B>
<PRE CLASS="verbatim">
RAT = [SGN] N+ UL N+
</PRE><BR>
<BR>
<LI CLASS="li-enumerate"><B>floats</B>
<PRE CLASS="verbatim">
FLOAT = [SGN] N+ . N+ [ (e | E) [SGN] N+ | Inf ]
      | [SGN] N+        (e | E) [SGN] N+
</PRE>checks are performed that the numbers are in a valid range.<BR>
<BR>
<LI CLASS="li-enumerate"><B>bounded reals</B>
<PRE CLASS="verbatim">
BREAL = FLOAT UL UL FLOAT
</PRE>where the first float must be less or equal to the second.</OL><BR>
If the syntax option <B>blanks_after_sign</B> is active, then
blank space (<CODE>BS*</CODE>) is allowed between the sign and the following digits.<BR>
<BR>
<LI CLASS="li-enumerate"><B>strings</B>
<PRE CLASS="verbatim">
STRING = SQ (NES | ES ANY+ | SQ BS* SQ)* SQ
</PRE>By default, consecutive strings are concatenated into a single string.
This behaviour can be disabled by the syntax option
<B>doubled_quote_is_quote</B>, which causes doubled quotes to be
interpreted as a single occurrence of the quote within the string.<BR>
<BR>
<LI CLASS="li-enumerate"><B>lists of character codes</B> 
<PRE CLASS="verbatim">
LIST = LQ (NES | ES ANY+ | LQ BS* LQ)* LQ
</PRE>By default, consecutive character lists are concatenated into a single character list.
This behaviour can be disabled by the syntax option
<B>doubled_quote_is_quote</B>, which causes doubled quotes to be
interpreted as a single occurrence of the quote within the string.
</OL>

<H4 CLASS="subsubsection">Variables</H4>
<PRE CLASS="verbatim">
VAR = (UC | UL) ALP*
</PRE>

<H4 CLASS="subsubsection">End of clause</H4>
<PRE CLASS="verbatim">
EOCL = . (BS | NL | &lt;end of file&gt;) | TS | &lt;end of file&gt;
</PRE>
<A NAME="toc168"></A>
<H3 CLASS="subsection"><A NAME="htoc308">A.2.4</A>&nbsp;&nbsp;Escape Sequences within Strings and Atoms</H3>
Within atoms and strings, the escape sequences (ES ANY+) are interpreted:
if the sequence matches one of the following valid escape sequences,
the corresponding special character is inserted into the quoted item.
<DIV CLASS="flushleft">
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=left NOWRAP><B>Escape Sequence</B>	</TD>
<TD ALIGN=left NOWRAP>	<B>Result</B></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>a</CODE>		</TD>
<TD ALIGN=left NOWRAP>	ASCII alert (7)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>b</CODE>		</TD>
<TD ALIGN=left NOWRAP>	ASCII backspace (8)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>f</CODE>		</TD>
<TD ALIGN=left NOWRAP>	ASCII form feed (12)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>n</CODE>		</TD>
<TD ALIGN=left NOWRAP>	ASCII newline (10)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>r</CODE>		</TD>
<TD ALIGN=left NOWRAP>	ASCII carriage return (13)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>t</CODE>		</TD>
<TD ALIGN=left NOWRAP>	ASCII tabulation (9)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>v</CODE>		</TD>
<TD ALIGN=left NOWRAP>	ASCII vertical tab (11)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>e</CODE>		</TD>
<TD ALIGN=left NOWRAP>	ASCII escape (27)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>d</CODE>		</TD>
<TD ALIGN=left NOWRAP>	ASCII delete (127)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES ES			</TD>
<TD ALIGN=left NOWRAP>	the ES character itself</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES AQ			</TD>
<TD ALIGN=left NOWRAP>	the AQ character itself</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES SQ			</TD>
<TD ALIGN=left NOWRAP>	the SQ character itself</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES LQ			</TD>
<TD ALIGN=left NOWRAP>	the LQ character itself</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES NL			</TD>
<TD ALIGN=left NOWRAP>	ignored</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>c</CODE> (BS<CODE>|</CODE>NL)*	</TD>
<TD ALIGN=left NOWRAP>	ignored</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES three octal digits	</TD>
<TD ALIGN=left NOWRAP>	character whose character code is
the given octal value</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>ES <CODE>x</CODE> hex digits ES	</TD>
<TD ALIGN=left NOWRAP>character whose character code is
the given hexadecimal value</TD>
</TR></TABLE>
</DIV>
Any other character following the ES constitutes a syntax error.
If the syntax option <B>iso_escapes</B> is active, the octal escape
sequence can be of any length and must be terminated with an ES character.<BR>
<BR>
<HR>
<A HREF="umsroot140.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot139.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot142.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
